#pragma once

//#include "dv.h"
#include <wx/wx.h>
#include <wx/dynarray.h>

//#include "../ExtSwitcher.h"

#include "../ro/all.h"
/*
#ifndef _USRDLL
	#pragma comment(lib, "plugins/ro/lib/roto.lib")
#else
	#ifndef DISTRIBVIEWER_EXPORTS
		#pragma comment(lib, "../../ro/lib/roto.lib")
	#else
		#pragma comment(lib, "../ro/lib/roto.lib")
	#endif
#endif
*/
class DistribProperty
{
private:
	roPreImage* m_source;
	int m_id;
	wxString m_comment;
	bool m_visible;
	wxColor m_pen;
	wxColor m_brush;
public:
	DistribProperty(roPreImage* source, int id, const wxString &comment,
		const wxColor &pen, const wxColor &brush)
	{
		m_source = source;
		m_id = id;
		m_comment = comment;
		m_visible = true;
		color(pen, brush);
	}
	void color(const wxColor &pen, const wxColor &brush)
	{
		m_pen = pen;
		m_brush = brush;
	}
	roPreImage* source(){ return m_source;}
	bool visible(){ return m_visible;}
	wxString comment(){ return m_comment;}
	wxColor pen(){ return m_pen;}
	wxColor brush(){ return m_brush;}
};

WX_DECLARE_HASH_MAP(int, DistribProperty*, wxIntegerHash,
					wxIntegerEqual, ImageList);


class DistribInit
{
public:
	static const int MODE_HISTOGRAM = 1;

	static const int TYPE_RED = 0;
	static const int TYPE_GREEN = 1;
	static const int TYPE_BLUE = 2;

	static const int TYPE_HUE = 0;
	static const int TYPE_SATURATION = 1;
	static const int TYPE_LIGHTNESS = 2;

	static const int TYPE_COLOR_MODEL = -1;
};

class /*DVXDLL*/ DistribViewer : public wxScrolledWindow
{
private:
	ImageList m_pack;
	int m_mode;
	int m_quantity;
	int m_type;
	wxColor m_pens[5];
	wxColor m_brushs[5];
public:
	DistribViewer(wxWindow* parent, wxWindowID id = wxID_ANY);
	int AddImage(roPreImage* img, const wxString &comment = "",
		unsigned long pen = 0, unsigned long brush = 0);
	void OnDraw(wxDC& dc);
	//void OnPaint(wxPaintEvent& WXUNUSED(event));
	void SetType(int type);
	void SetMode(int mode);
	void Display(int mode, int type);
private:
	void OnMouseEvent(wxMouseEvent& event);
	DECLARE_EVENT_TABLE()
};